from Tkinter import *
import pygame.mixer
import tkMessageBox

def track_start():
    """docstring for track_start"""
    track.play(loops = -1)

def track_stop():
    """docstring for track_stop"""
    track.stop()

def shutdown():
    """docstring for shutdown"""
    if tkMessageBox.askokcancel("R U sure?","Really want to quit?"):
        track.stop()
        app.destroy()

#Creat tht GUI application window
app = Tk()
app.title("Head First Mix")
app.geometry('250x100+200+100')

#ID the track
sound_file = "50459_M_RED_Nephlimizer.wav"
mixer = pygame.mixer
mixer.init()
track = mixer.Sound(sound_file)

#Creat button for start and stop
star_button = Button(app, command = track_start, text = "Start")
star_button.pack(side = LEFT)

stop_button = Button(app, command = track_stop, text = "Stop")
stop_button.pack(side = RIGHT)

app.protocol("WM_DELETE_WINDOW", shutdown)

app.mainloop()
